/*-------------------------------------------------------------------------
 *
 * relmapdesc.c
 *	  utils/cache/relmapper.c 的 rmgr 描述例程
 *
 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *	  src/backend/access/rmgrdesc/relmapdesc.c
 *
 *-------------------------------------------------------------------------
 */
#include "postgres.h"

#include "utils/relmapper.h"

void relmap_desc(StringInfo fc_buf, XLogReaderState *fc_record)
{
	char	   *fc_rec = XLogRecGetData(fc_record);
	uint8		fc_info = XLogRecGetInfo(fc_record) & ~XLR_INFO_MASK;

	if (fc_info == XLOG_RELMAP_UPDATE)
	{
		xl_relmap_update *fc_xlrec = (xl_relmap_update *) fc_rec;

		appendStringInfo(fc_buf, "database %u tablespace %u size %d",
						 fc_xlrec->dbid, fc_xlrec->tsid, fc_xlrec->nbytes);
	}
}

const char * relmap_identify(uint8 fc_info)
{
	const char *fc_id = NULL;

	switch (fc_info & ~XLR_INFO_MASK)
	{
		case XLOG_RELMAP_UPDATE:
			fc_id = "UPDATE";
			break;
	}

	return fc_id;
}
